import { forwardRef, Module } from '@nestjs/common';
import { MatchService } from './match.service';
import { MatchController } from './match.controller';
import { TypeOrmModule } from '@nestjs/typeorm';
import { MatchInfo } from './entities/match.entity';
import { Stage } from '../stage/entities/stage.entity';
import { StageService } from '../stage/stage.service';
import { GroupPlayerScoreService } from '../group-player-score/group-player-score.service';
import { GroupPlayerScore } from '../group-player-score/entities/group-player-score.entity';
import { TournamentService } from '../tournament/tournament.service';
import { Tournament } from '../tournament/entities/tournament.entity';
import { GroupService } from '../group/group.service';
import { Group } from '../group/entities/group.entity';
import { MatchListener } from './match.listener';
import { WebsocketsServer } from 'src/common/websocket.server';
import { EventService } from '../event/event.service';
import { Event } from '../event/entities/event.entity';
import { MatchGiveUpService } from './services/match-giveup';
import { MatchScoreService } from './services/match-score';
import { MatchEndService } from './services/match-end';
import { CategoryService } from '../category/category.service';
import { Category } from '../category/entities/category.entity';
import { MatchReadyService } from './services/match-ready';
import { ConfirmPlayerE2PService } from '../event-to-player/services/confirmPlayerE2P.service';
import { PlayerSignupService } from '../player-signup/service/player-signup.service';
import { PlayerSignup } from '../player-signup/entities/player-signup.entity';
import { EventToPlayerModule } from '../event-to-player/event-to-player.module';
import { MatchCacheService } from './match.cache.service';
import { MatchServiceV2 } from './match.service.v2';
import { MatchControllerV2 } from './match.controller.v2';
import { MatchInfoV2 } from './entities/match.entity.v2';
import { HttpModule } from '@nestjs/axios';
import { TournamentCacheService } from '../tournament/tournament.cache.service';
import { TournamentModule } from '../tournament/tournament.module';
import { StageModule } from '../stage/stage.module';
import { StageCacheService } from '../stage/stage.cache.service';

@Module({
  imports: [
    TypeOrmModule.forFeature([
      MatchInfo,
      MatchInfoV2,
      Stage,
      GroupPlayerScore,
      // Tournament,
      Group,
      // EventToPlayer,
      Event,
      Category,
      PlayerSignup,
    ]),
    forwardRef(() => EventToPlayerModule),
    HttpModule,
    TournamentModule,
    // StageModule,
    // forwardRef(() => TournamentModule),
  ],
  controllers: [MatchController, MatchControllerV2],
  providers: [
    MatchService,
    MatchCacheService,
    MatchServiceV2,
    MatchListener,
    StageService,
    StageCacheService,
    GroupPlayerScoreService,
    // TournamentService,
    // TournamentCacheService,
    GroupService,
    WebsocketsServer,
    EventService,
    // EventToPlayerService,
    MatchGiveUpService,
    MatchScoreService,
    MatchEndService,
    CategoryService,
    MatchReadyService,
    ConfirmPlayerE2PService,
    PlayerSignupService,
  ],
  exports: [MatchService, MatchCacheService, MatchServiceV2],
})
export class MatchModule {}
